/**
 * 
 */
package com.sesame.daoimpl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.sesame.dao.FriendDAO;
import com.sesame.domain.Friend;

/**
 * @author voidman
 * 
 */
public class FriendDAOImpl extends SqlMapClientDaoSupport implements FriendDAO {

    public void addFriend(Friend Friend) {
        getSqlMapClientTemplate().insert("addFriend", Friend);
    }

    public void deleteFriendById(Integer id) {
        getSqlMapClientTemplate().delete("deleteFriendById", id);
    }

    @SuppressWarnings("unchecked")
    public List<Friend> getAllFriend() {
        List<Friend> listFriend;
        listFriend = getSqlMapClientTemplate().queryForList("getAllFriend");
        return listFriend;
    }
    
    public Friend getFriendById(Integer id) {

        return (Friend) getSqlMapClientTemplate().queryForObject("getFriendById", id);
    }

    public void updateFriend(Friend Friend) {
        getSqlMapClientTemplate().update("updateFriend", Friend);
    }

}
